<?php
define('ipos',true);
require_once('./include/config.php');
require_once('./template/themes.php');
// what us ipos
$ipos	=	$_GET['ipos'];
$value	=	explode("/",$ipos);

//print_r($value);die();

require_once('./template/actions.php');
// reset viewed
$day = date('d',NOW);
$current_day = getConfig(5);
if ($day != $current_day) {
	$db->dbupdate("film","viewed_day = 0","phimid > 0");
	$db->dbupdate("config","cf_value = '$day'","cf_id = 5");
}
//time limit
if($_SESSION["ipos_userid"]) {
	$iposuser	=	$db->database("timelimit","user","userid = '".$_SESSION["ipos_userid"]."' AND usergroup = 1");
	if($iposuser) {
		if($iposuser[0][0]<NOW) {
			$db->dbupdate("user","usergroup=0,timelimit=0","userid = '".$_SESSION["ipos_userid"]."'");
		}
	}
}
//logout
if(isset($_GET['logout'])) {
	unset($_SESSION["ipos_userid"]);
	unset($_SESSION["ipos_usergroup"]);
	unset($_SESSION["ipos_username"]);
	_SETCOOKIE("member_id");
	_SETCOOKIE("member_pass");
	header("Location: /");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <base href="<?=MAIN_URL;?>/" />
    <title><?=$webtitle;?></title>
    <?php
	if($value[0] == 'error') echo "<meta name=\"robots\" content=\"noindex,nofollow\" />\n";
	else echo "<meta name=\"robots\" content=\"index,follow\" />\n";
	?>
    <meta name="description" content="<?=$webdesc;?>"/>
    <meta name="keywords" content="<?=$webkey;?>" />	
    <link rel="canonical" href="<?=MAIN_URL.URL_LOAD;?>" />
	<?=$head;?>
	
	<?php $dir = "test-code-film-03";?>
	<?php $style = MAIN_URL . "/" . $dir; ?>
	<?php $fixed_main_url = MAIN_URL . $dir; ?>
	
	
    <link type="text/css" href="<?php echo $style; ?>/template/css/main.css" rel="stylesheet" />
    
    <script type="text/javascript" src="<?php echo MAIN_URL . "/" . $dir . "/" . "template/js/movie.jq.js"?>" charset="utf-8"></script>
    
    <script type="text/javascript">
		var yh_folder = 'test-code-film-03';
		var ajax_url = '<?php echo MAIN_URL;?>' + '/' + yh_folder;
		ajax_url += '/ajax.php';
		// console.log(ajax_url);  
    </script>
    
    <script type="text/javascript" charset="utf-8" src="<?php echo MAIN_URL . "/" . $dir . "/template/js/movie.js"?>"></script>
	
	<script type="text/javascript" charset="utf-8" src="<?php echo MAIN_URL . "/" . $dir . "/template/js/font.js"?>"></script>
	
	<script type="text/javascript">
	
	  var _gaq = _gaq || [];
	  _gaq.push(['_setAccount', 'UA-40711889-1']);
	  _gaq.push(['_trackPageview']);
	
	  (function() {
	    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  })();
	
	</script>

    <?=$java;?>
<?php /*rrt*/
echo $code; ?>
</head>

<body>
<?php if(!$showMovie)	require_once("./template/header.php"); ?>
<div id="main" class="wauto <?php if($showMovie) echo 'popupMovie';?>">
	<?php
	// phân tích trang
	if(in_array($value[0], array('index','home','trang-chu',''))) 		
		require_once("./template/home.php");
	elseif(in_array($value[0], array('the-loai','quoc-gia','danh-sach','tag','tim-kiem'))) 
		require_once("./template/list.php");
	elseif($value[0] == 'phim')
		require_once("./template/info.php");
	elseif($value[0] == 'xem-phim')
		require_once("./template/play.php");
	elseif($value[0] == 'thanh-vien')
		require_once("./template/member.php");
	elseif($value[0] == 'pages')
		require_once("./template/pages.php");
	elseif($value[0] == 'bang-xep-hang')
		require_once("./template/rank.php");
	elseif($value[0] == 'error')
		require_once("./template/error.php");
   	else		
		require_once("./template/error.php");
    ?>
</div>
<!-- end main -->
<?php if(!$showMovie)	require_once("./template/footer.php"); ?>
</body>
</html>